/*
 * @Author: jiu yin
 * @Date: 2024-06-13 17:51:10
 * @LastEditTime: 2024-06-19 17:57:11
 * @LastEditors: jiu yin zhen jing
 * @FilePath: \studio-web-admin\src\view\message\detail.tsx
 * jiu
 */

import { detail_message,read_message } from "@/api/home";
import { useRoute } from "@/hooks";
import { ArrowLeftOutlined } from "@ant-design/icons";
import { Button } from "antd";
import { useEffect, useState } from "react";

export default function detail() {
	let { getParams, back,push } = useRoute();
	let { id } = getParams();

	let [detail, setDetail] = useState({} as any);

	useEffect(() => {
		//标记已读
		read_message({ id: Number(id) })
		// 获取详情
		detail_message({ id: Number(id) }).then((res: any) => {
			setDetail(res.data);
		});
	}, [id]);

	return (
		<section className="ml-auto mr-auto w-920px mt-20px detail">
			<div dangerouslySetInnerHTML={{ __html: detail.content }} />
			<div className="flex">
				<Button icon={<ArrowLeftOutlined />} onClick={() => push("/message")} className="ml-auto mt-40px mb-40px">
					返回消息列表
				</Button>
			</div>
		</section>
	);
}
